FROM registry.cn-shenzhen.aliyuncs.com/bo_yw/golang:1.21-alpine AS builder
LABEL project="bank-job"

ENV GO111MODULE=on \
    GOPROXY=https://goproxy.cn,direct \
    CGO_ENABLED=0 \
    GOOS=linux \
    GOARCH=amd64

WORKDIR /usr/src/job

COPY . /usr/src/job

RUN go mod tidy

RUN ls -al

RUN go build -o job

FROM registry.cn-shenzhen.aliyuncs.com/bo_yw/alpine:latest AS runner

RUN sed -i 's/dl-cdn.alpinelinux.org/mirrors.aliyun.com/g' /etc/apk/repositories && apk add tzdata && ls /usr/share/zoneinfo

ENV TZ=Asia/Shanghai

COPY --from=builder /usr/src/job/job /opt

WORKDIR /opt

EXPOSE 8801

ENTRYPOINT ["./job"]
